/**
 * Email ：huangyijia138@qq.com
 * Des：
 *
 * @description: 2r3
 * @author: huangjiajia
 * @create: 2025-01-24 16:36
 **/
public class Student03 {



    private String name;
    private String no;

    private Course03 course03;

    public Student03(String name, String no, Course03 course03) {
        this.name = name;
        this.no = no;
        this.course03 = course03;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public Course03 getCourse03() {
        return course03;
    }

    public void setCourse03(Course03 course03) {
        this.course03 = course03;
    }

    public void selection(Course03 course03){
        this.setCourse03(course03);
        System.out.println(this.getName() + "选课成功，课程是：" + course03.getName());
    }
    public void cancel(){
        String courseName = this.getCourse03().getName();
        this.setCourse03(null);
        System.out.println(this.getName() + "退课成功，所选课程是" + courseName);
    }

    public void display(){
        System.out.println("学号" + this.getNo() + "姓名；" + this.getName());

        if(this.getCourse03() == null){
            System.out.println("还未选课");

        }else{
            System.out.println("所选课程名称；"+ this.getCourse03().getName()+"授课老师；" + this.getCourse03().getTeacher());
        }

    }
}
